package com.itlong.cloud.property;


import com.itlong.cloud.iottp.IIotTpSmsServiceClient;
import com.itlong.cloud.project.property.IPropertyCloudServiceCostMessageServiceClient;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * <desc>
 *      定时向未设置批次号的云对讲设备推送设备过期时间.
 * </desc>
 *
 * @createDate 2018/7/5
 */
@EnableScheduling // 启用定时任务
@RestController
public class PropertyCloudServiceCostPushCloudTalkTimedTask {
    private static Logger LOG = LoggerFactory.getLogger(PropertyCloudServiceCostPushCloudTalkTimedTask.class);

    @Autowired
    IPropertyCloudServiceCostMessageServiceClient iPropertyCloudServiceCostMessageServiceClient;

    @Autowired
    IIotTpSmsServiceClient iIotTpSmsServiceClient;


    @Scheduled(cron = "0 20 0 * * ?") // 每天凌晨0点20分执行
//    @Scheduled(cron = "0 0/5 * * * ?") // 每5分钟执行一次
    //@Scheduled(cron = "0 0 * * * ?") // 每小时执行一次
    public void timeTaskSychro() throws Exception {

        try {
            iPropertyCloudServiceCostMessageServiceClient.pushCloudTalk();
        } catch (Exception e) {
            throw e;
        }

    }
}